package com.dd.common.dto.user;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * @author cheng
 */
@Schema(description = "前台用户注册DTO")
@Data
public class UserRegisterDTO implements java.io.Serializable {
    @NotBlank(message = "用户名不能为空")
    @Pattern(regexp = "^[a-zA-Z0-9_]{4,16}$", message = "用户名只能包含字母、数字、下划线，长度4-16个字符")
    @Schema(description = "用户名", example = "ikun")
    private String username;
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 32, message = "密码长度必须在6到32位之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]{6,32}$", message = "密码只能包含字母、数字、下划线，长度6-32个字符")
    @Schema(description = "密码", example = "123456")
    private String password;
}
